<?php

/**
 * Factura filter form base class.
 *
 * @package    courier
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseFacturaFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'fac_numfactura'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fac_rif'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fac_dirfiscal'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fac_cantpaquete'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fac_envioxpaquete' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fac_montototal'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fac_telefonos'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fac_solicitud'     => new sfWidgetFormPropelChoice(array('model' => 'Solicitud', 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'fac_numfactura'    => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'fac_rif'           => new sfValidatorPass(array('required' => false)),
      'fac_dirfiscal'     => new sfValidatorPass(array('required' => false)),
      'fac_cantpaquete'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'fac_envioxpaquete' => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'fac_montototal'    => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'fac_telefonos'     => new sfValidatorPass(array('required' => false)),
      'fac_solicitud'     => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Solicitud', 'column' => 'sol_id')),
    ));

    $this->widgetSchema->setNameFormat('factura_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Factura';
  }

  public function getFields()
  {
    return array(
      'fac_id'            => 'Number',
      'fac_numfactura'    => 'Number',
      'fac_rif'           => 'Text',
      'fac_dirfiscal'     => 'Text',
      'fac_cantpaquete'   => 'Number',
      'fac_envioxpaquete' => 'Number',
      'fac_montototal'    => 'Number',
      'fac_telefonos'     => 'Text',
      'fac_solicitud'     => 'ForeignKey',
    );
  }
}
